<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button>按钮</button>
  <script>
    const btn = document.querySelector('button')
    // 赋值点击事件 会被覆盖
    btn.onclick = ()=> {
      console.log('按钮被点击了111')
    }
    btn.onclick = ()=> {
      console.log('按钮被点击了222')
    }
    // 追加点击事件 不会覆盖
    btn.addEventListener('click', (e)=> {
      console.log('按钮点击了箭头函数',e.currentTarget)
    })
    btn.addEventListener('click', function() {
      console.log('按钮被点击了function函数',this)
    })
  </script>
</body>
</html>